<?php

declare (strict_types = 1);

namespace auth;

trait Authenticatable
{
    /**
     * 获取模型对象的主键字段名
     *
     * @return string
     */
    public function getAuthIdentifierName(): string
    {
        return $this->getPk();
    }

    /**
     * 获取模型对象的主键值
     *
     * @return mixed
     */
    public function getAuthIdentifier()
    {
        return $this->{$this->getAuthIdentifierName()};
    }

    /**
     * 获取模型对象的密码字段名
     *
     * @return string
     */
    public function getAuthPassword(): string
    {
        return $this->password;
    }
}
